<?php
   /**
    *
    * FILE:          monthlyISRList.php
    * LOCATION:      /root/forms/
    * REFERENCES:    none 
    * FUNCTION:          
    * DEPENDENCIES: 
    *
    *                
    * 
    * ==============================================================================
    * 
    * @version $Id: nav.php,v 0.1 2007/09/3
    * @copyright Copyright (c) none
    * @author Chris V
    * @license http://opensource.org/licenses/gpl-license.php GNU General 
    * Public License (GPL)
    * 
    * ==============================================================================
    * 
    */


   //connect to db
   include('includes/db_connect.php');
$isrId= $_GET['isrId'];
$irId = $_GET['irId'];
$id = $_GET['id'];

//echo "<h1>".$id."</h1>";
   //get all case notes for this consumer	
   /*
   $query = "SELECT * 
             FROM monthlyISR 
             WHERE consumer_id = ".$id." 
             ORDER BY case_note_year, case_note_month desc";
   */
   $query = "SELECT * 
                        FROM monthlyISR 
                       WHERE consumer_id = ".$id;

   //echo $query."<br/>";

   //hold data 
   $result = mysql_query($query);
   $total_ISRs = mysql_num_rows($result);
   //counter
   $i=0;
?>
<h2 class="gt-table-head">You have <?=$total_ISRs;?> casenotes in the system</h2>
<p>
   Choose a previous case note to edit or 
   click on the "Create New Entry" link on the bottom right and create a new record.
</p>

<table style="width:100%;" class="gt-list-table">
   <thead>
      <tr>
	  <th style="width:4em;padding-bottom:20px;"><strong>Case Note ID</strong></th>
	  <th style="width:4em;padding-bottom:20px;"> <strong>Case Note Month</strong></th>
        <th style="width:4em;padding-bottom:20px;"><strong>Case Note Year</strong></th>
      </tr>
  </thead>
  <tbody>
<?php 
    //records retrieved, set style rule
    while($row=mysql_fetch_array($result)) {
       //echo "<pre>";
       //print_r($row);
       //echo "</pre>";
	if($i%2==0) {
 	    echo "<tr class='even'>";
        }else {
  	    echo "<tr class='odd'>";
        }

       //lets format the month number to a string
       switch ($row["case_note_month"]) {
              case 1:
                       $month = "January";
                       break;
              case 2:
                      $month = "February";
                       break;
              case 3:
                      $month = "March";
                       break;
              case 4:
                      $month = "April";
                       break;
              case 5:
                      $month = "May";
                       break;
              case 6:
                      $month = "June";
                       break;
              case 7:
                      $month = "July";
                       break;
              case 8:
                      $month = "August";
                       break;
              case 9:
                      $month = "September";
                       break;
              case 10:
                      $month = "October";
                       break;
              case 11:
                      $month = "November";
                       break;
              case 12:
                       $month = "December";
                       break;
      }
?>
        <td>
            <a style="margin-right:40px;" href="admin.php?action=cieedit&id=<?php echo $id; ?>&form=monthlyISR&isrId=<?php echo $row["id"]?>">
               Case Note #<?php echo $row["id"]?>
            </a>
        </td>
        <td>
            <a href="admin.php?action=cieedit&id=<?php echo $id; ?>&form=monthlyISR&isrId=<?php echo $row["id"]?>">
               <?php echo $month; ?>
            </a>
        </td>
  	<td>
            <a href="admin.php?action=cieedit&id=<?php echo $id; ?>&form=monthlyISR&isrId=<?php echo $row["id"]?>">
               <?php echo $row["case_note_year"]; ?>
            </a>
        </td>
     </tr>
<?php 
     $i++; 
   }//end while loop for recored retrieval 
?>
<?php 
   if($i==0) {
?>
	<tr>
		<td colspan="2">No Monthly Individual Service Records Found</td>
	</tr>
<?php } ?>
	</tbody>
</table>
<br/>

<p style="text-align:right;">
				<a style="background-image:url('./images/gt/btn-blank-long.jpg');
											background-repeat:no-repeat;
											border:none;
											line-height:3em;
											padding:7px 25px 7px 15px;
											width:160px;
											height: 30px;
											color: #fff;
											font-weight:bold;
											text-decoration:none;" 
							class="btn" href="admin.php?action=cieedit&id=<?php echo $id; ?>&form=monthlyISR&isrId=0">
				<strong>Create New Case Note</strong>
		</a>
</p>